import {get, post} from "./axios";

// 添加收藏分类
export function addClassify(data) {
  return post('/collect/create', data)
}

// 获取分类列表
export function getClassify(type, userId) {
  return get('/collect/categoryList', {
    params: {
      type: type,
      userId: userId
    }
  })
}

// 删除收藏分类
export function delClassify(data) {
  return post('/collect/delete', data)
}

// 用户点击收藏面经、题库
export function collect(data) {
  return post('/collect/addCollection', data)
}

// 删除、取消对应收藏
export function cancelCollect(data) {
  return post('/collect/deleteCollection', data)
}

// 判断用户是否收藏
export function isCollect(type, userId, collectId) {
  return get('/collect/isCollect', {
    params: {
      type: type,
      userId: userId,
      collectId: collectId,
    }
  })
}

// 获取我的收藏列表
export function myCollection(type, userId) {
  return get('/user/collection', {
    params: {
      type: type,
      userId: userId
    }
  })
}

// 点击取消收藏
export function cancelCollection (data) {
  return post('/collect/cancelCollection', data)
}
